<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
            background-color: #ffeef7;
        }

        /* 第一个轮播图样式 */
        .slider1 {
            width: 800px;
            height: 500px;
            overflow: hidden;
            position: absolute;
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
            top: 30px;
            left: 250px;
        }

        .slides1 {
            display: flex;
            width: 100%;
            height: 100%;
            transition: transform 0.5s ease-in-out;
        }

        .slide1 {
            position: relative;
            flex: 0 0 100%;
            width: 100%;
            height: 100%;
            object-fit: contain;
            max-width: 800px;
            max-height: 500px;
        }

        .controls1 {
            position: absolute;
            top: 50%;
            transform: translateY(-50%);
            display: flex;
            width: 100%;
            justify-content: center;
        }

        .prev-btn1 {
            position: absolute;
            left: 10px;
        }

        .next-btn1 {
            position: absolute;
            right: 10px;
        }

        .control-btn {
            background-color: rgba(0, 0, 0, 0.5);
            color: white;
            border: none;
            padding: 10px 20px;
            cursor: pointer;
            border-radius: 5px;
            transition: background 0.3s ease, transform 0.2s ease;
        }

        .control-btn:hover {
            background: linear-gradient(to bottom right, #43A047, #7CB33F);
            transform: scale(1.1);
        }

        /* 第二个轮播图样式 */
        .slider2 {
            width: 800px;
            height: 500px;
            overflow: hidden;
            position: absolute;
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
            top: 620px;
            left: 250px;
        }

        .slides2 {
            display: flex;
            width: 100%;
            height: 100%;
            transition: transform 0.5s ease-in-out;
        }

        .slide2 {
            position: relative;
            flex: 0 0 100%;
            width: 100%;
            height: 100%;
            object-fit: contain;
            max-width: 800px;
            max-height: 500px;
        }

        .controls2 {
            position: absolute;
            top: 50%;
            transform: translateY(-50%);
            display: flex;
            width: 100%;
            justify-content: center;
        }

        .prev-btn2 {
            position: absolute;
            left: 10px;
        }

        .next-btn2 {
            position: absolute;
            right: 10px;
        }

        div[style*="HaoHaoChi"] {
            transform: translate(150px, 80px);
        }

        .haohaochi-text {
            position: absolute;
            top: 550px;
            left: 220px;
        }
    </style>
</head>

<body>
<!-- 第一个轮播图 -->
<div class="slider1">
    <div class="slides1">
        <img class="slide1" src="images/芝士.jpg" alt="Image 1" onclick="location.href='productview/cake5.htm'">
        <img class="slide1" src="images/蛋糕.jpg" alt="Image 2" onclick="location.href='productview/cake7.htm'">
    </div>
    <div class="controls1">
        <button class="control-btn prev-btn1" onclick="prevSlide1()"><</button>
        <button class="control-btn next-btn1" onclick="nextSlide1()">></button>
    </div>
</div>

<!-- 添加的内容 -->
<div class="haohaochi-text">
    <span style="font-weight: 700"><font face="宋体" size="7">&nbsp;</font></span></u></span><span style="text-decoration: overline; font-weight: 600"><u><font face="宋体" size="7">HaoHaoChi&nbsp;HaoHaoChi&nbsp;HaoHaoChi </font></u></span>
</div>
<!-- 第二个轮播图 -->
<div class="slider2">
    <div class="slides2">
        <img class="slide2" src="images/门店.jpg" alt="Image 4">
        <img class="slide2" src="images/门店2.jpg" alt="Image 5">
        <img class="slide2" src="images/门店3.jpg" alt="Image 6">
    </div>
    <div class="controls2">
        <button class="control-btn prev-btn2" onclick="prevSlide2()"><</button>
        <button class="control-btn next-btn2" onclick="nextSlide2()">></button>
    </div>
</div>

<script>
    // 第一个轮播图控制函数
    let slideIndex1 = 0;
    const slides1 = document.querySelector('.slides1');
    const totalSlides1 = document.querySelectorAll('.slide1').length;

    function nextSlide1() {
        slideIndex1++;
        if (slideIndex1 >= totalSlides1) {
            slideIndex1 = 0;
        }
        updateSlide1();
    }

    function prevSlide1() {
        slideIndex1--;
        if (slideIndex1 < 0) {
            slideIndex1 = totalSlides1 - 1;
        }
        updateSlide1();
    }

    function updateSlide1() {
        const translateValue1 = -slideIndex1 * 100;
        slides1.style.transform = `translateX(${translateValue1}%)`;
    }

    // 第二个轮播图控制函数
    let slideIndex2 = 0;
    const slides2 = document.querySelector('.slides2');
    const totalSlides2 = document.querySelectorAll('.slide2').length;

    function nextSlide2() {
        slideIndex2++;
        if (slideIndex2 >= totalSlides2) {
            slideIndex2 = 0;
        }
        updateSlide2();
    }

    function prevSlide2() {
        slideIndex2--;
        if (slideIndex2 < 0) {
            slideIndex2 = totalSlides2 - 1;
        }
        updateSlide2();
    }

    function updateSlide2() {
        const translateValue2 = -slideIndex2 * 100;
        slides2.style.transform = `translateX(${translateValue2}%)`;
    }

    // 自动切换可以保留也可以注释掉
    setInterval(nextSlide1, 3000);
    setInterval(nextSlide2, 3000);
</script>
</body>

</html>